<script setup lang="ts">
import { computed } from "vue";
// 计算use标签的xlink:href的属性值
const symbolId = computed(() => `${props.prefix}${props.name}`);

const props = defineProps({
  prefix: {
    type: String,
    default: "#icon-",
  },
  name: {
    type: String,
    required: true,
  },
  color: {
    type: String,
    default: "",
  },
  width: {
    type: String,
    default: "16px",
  },
  height: {
    type: String,
    default: "16px",
  },
});
</script>

<template>
  <div>
    <svg :style="{ width, height }">
      <use :xlink:href="symbolId" :fill="color"></use>
    </svg>
  </div>
</template>

<style scoped></style>
